<template>
  <div class="graphic-layout">
    <div class="d-content">
      <div
        v-if="componentData.imgAlign === 'left'"
        class="img-box"
        :style="{
          backgroundImage: `url(${encodeURI(componentData.coverImage)})`,
        }"
      ></div>
      <div class="flex">
        <p class="blue ft-26 ft-bold">
          {{ componentData[`title${capitalizeLang}`] }}
        </p>
        <p class="ft-16 mt-12">
          {{ componentData[`content${capitalizeLang}`] }}
        </p>
        <div class="btn" :class="{ fr: componentData.imgAlign === 'left' }">
          <div v-for="icon in componentData.icon" :key="icon.id" class="btn-item">
            <img :src="icon.url" alt="" />
            <span class="ft-8 mt-10">{{ icon[`title${capitalizeLang}`] }}</span>
            <span class="ft-8">{{ icon[`subtitle${capitalizeLang}`] }}</span>
          </div>
        </div>
      </div>
      <div
        v-if="componentData.imgAlign !== 'left'"
        class="img-box"
        :style="{
          backgroundImage: `url(${encodeURI(componentData.coverImage)})`,
        }"
      ></div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  props: {
    componentData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {}
  },
  computed: {
    ...mapGetters(['capitalizeLang']),
  },
  methods: {},
}
</script>

<style lang="less" scoped>
@import '~assets/var';

.graphic-layout {
  background-color: #fff;
  position: relative;
  overflow: hidden;
  margin: 0 auto;

  .d-content {
    background: #f6f7f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .width(1200);
    .pd(45, 0, 45, 0);
    .mgAuto(0, 30);

    .flex {
      .width(580);
      .pd(0, 40, 0, 40);

      flex-direction: column;

      .ft-26 {
        .ft(26);
      }

      .ft-16 {
        .ft(16);
      }

      .mt-12 {
        .mg(12, 0, 0, 0);
      }

      .btn {
        display: flex;
        .ft(12);
        .mg(20, 0, 0, 0);

        color: #0261bc;

        &.fr {
          justify-content: flex-end;
        }

        .btn-item {
          display: flex;
          flex-direction: column;
          text-align: center;
          overflow: hidden;
          .maxWidth(94);
          .mg(0, 10, 0, 10);
          .ft(12);

          img {
            .width(50);
            .height(50);

            filter: drop-shadow(#0261bc 100px 0); // 在右侧 100px 加一个 #FFF 的阴影
            transform: translateX(-100px);
            margin-bottom: 0;
            margin: 0 auto;
          }

          .ft-8 {
            .ft(20);
            .lineH(20);
            .mg(8, 0, 0, 0);

            display: inline-block;
            zoom: 0.5;
          }

          .mt-10 {
            .mg(12, 0, 0, 0);
          }
        }
      }
    }

    .img-box {
      .width(460);
      .height(260);
      background-size: auto 100%;
      background-position: center;
    }
  }
}
</style>
